<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div id="app">
        <cpn1></cpn1>
        <cpn1></cpn1>
        {{message}}
    </div>

    <!-- 1 script标签 注意：类型必须是text/x-template-->
    <!-- <script type="text/x-template" id="cpn">
        <div>
            <h2>我是标题1</h2>
            <p>hahhah11111</p>
        </div>
    </script> -->

    <!--2 template标签 -->
    <template id="cpn2">
        <div>
            <h2>我是标题2</h2>
            <p>hahhah222222</p>
        </div>
    </template>


    <script src="../js/vue.js"></script>
    <script>
        
// 注册全局组建
        Vue.component('cpn1',{
            // template:"#cpn"
            template:"#cpn2"
        })


        const app = new Vue({
            el:'#app',
            data:{
                message:'你好呀！',
            }
        })
    </script>
</body>
</html>